export default defineNuxtRouteMiddleware(async (to) => {
  // allow auth pages
  if (to.path.startsWith('/auth')) return
  // server-side will have auth via middleware; client-side check me
  try {
    const { user } = await $fetch('/api/auth/me')
    if (!user) return navigateTo('/auth/login')
  } catch {
    return navigateTo('/auth/login')
  }
})


